<template>
	<view class="page-main">
		<view v-for="item in state.list" :key="item.time">
			<view class="time">{{item.time}}</view>
			<view class="jobCardBox">
				<job-card :list="item.data"></job-card>
			</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import jobCard from "@/components/job-card.vue"
	import { ref,reactive,getCurrentInstance} from 'vue'
	import { onLoad } from '@dcloudio/uni-app';
	import {userStore} from '@/pinia';
	import {useRouter} from 'uni-mini-router'
	const userStoreInfo = userStore();
	const router = useRouter()
	const {proxy} = getCurrentInstance()
	
	let state = reactive({
		id:'',
		scrollJin:[], //招聘分类
		currentObj:{},//当前选中的分类
		list:[],//招聘分类下的岗位
	})
	
	//获取求职记录分页列表查询
	const meiyeRecruitJobLog2List = () => {
		let params = {
			status:0
		}
		proxy.$req('GET', proxy.$api.meiyeRecruitJobLog2List, params).then((res) => {
			console.log(res);
			if(res.code === 200){
				let arr = []
				res.result.forEach((el,i)=>{
					console.log(el)
					 Object.keys(el).forEach(v=>{
						let newArr = []
						res.result[i][v].forEach(val=>{
							newArr.push(val.job)
						})
						res.result[i][v] = res.result[i][v]
						let obj ={
						 	time:v,
							data:newArr
						}
						arr.push(obj)
					})
				})
				state.list = arr
			}
		})
	}
	
	onLoad(()=>{
		meiyeRecruitJobLog2List()
	})
</script>

<style lang="scss" scoped>
	page{
		background:#f6f6f6;
		height:100%;
	}
	.page-main{
		.time{
			padding:0 24rpx;
		}
	}
</style>